import { BasicColumn } from '@/design/components/Table';
import { ElTag } from 'element-plus';
import { h } from 'vue';

export const columns: BasicColumn[] = [
  {
    label: '菜单名称',
    prop: 'name',
  },
  {
    label: '路由',
    prop: 'router',
  },
  {
    label: '路由路径',
    prop: 'path',
  },
  {
    label: '权限标识',
    prop: 'permission',
  },
  {
    label: '排序',
    prop: 'sort',
  },
  {
    label: '类型',
    prop: 'type',
    render({ row: record }) {
      return h(
        ElTag,
        {
          type: record.type === '1' ? 'success' : 'info',
        },
        {
          default: () => (record.type === '1' ? '菜单' : '权限'),
        },
      );
    },
  },
  {
    label: '状态',
    prop: 'status',
    render({ row: record }) {
      return h(
        ElTag,
        {
          type: record.status === 1 ? 'success' : 'danger',
        },
        {
          default: () => (record.status === 1 ? '正常' : '禁用'),
        },
      );
    },
  },
  {
    label: '创建时间',
    prop: 'createTime',
  },
];
